package com.sctvcloud.longchang.ui.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bumptech.glide.Glide;
import com.ruihang.generalibrary.beans.ShareItem;
import com.ruihang.generalibrary.ui.adapter.BaseAbstractAdapter;
import com.ruihang.generalibrary.ui.adapter.holder.ShareHolder;
import com.sctvcloud.longchang.R;
import com.sctvcloud.longchang.beans.ConvenientTelTypeBean;
import com.sctvcloud.longchang.ui.adapter.holder.ConvenientTelHolder;
import com.sctvcloud.longchang.ui.utils.GlideUtil;

import java.util.List;

/**
 * 便民电话适配
 */
public class ConvenientTelAdapter extends BaseAbstractAdapter<ConvenientTelTypeBean> {

    public ConvenientTelAdapter(Context context, List<ConvenientTelTypeBean> datas) {
        super(context, datas);
    }

    public ConvenientTelAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ConvenientTelHolder holder = null;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_convenient_tel, viewGroup, false);
            holder = new ConvenientTelHolder(view);
        } else {
            holder = (ConvenientTelHolder) view.getTag();
        }
        ConvenientTelTypeBean typeBean = datas.get(i);
        GlideUtil.getGlideWith11DefNoFitCenterCrop(context,typeBean.getLogoImg()).into(holder.img);
        holder.itemName.setText(typeBean.getInstitution());
        return view;
    }
}

